/**
 * 获取Web流量仪表盘配置项
 */
function getWebStreamGaugeOption() {
    let option = {
        backgroundColor: '',
        tooltip: {
            trigger: 'item'
        },
        series: [{
            name: '当前流速',
            type: 'gauge',
            min: 0,
            max: 400,
            splitNumber: 10,
            center: ['50%', '90%'], // 默认全局居中
            radius: '160%',
            startAngle: 180,
            endAngle: 0,
            tooltip: {
                formatter: "{b}:{c}MB/分钟"
            },
            title:{
                show:false
            },
            axisLine: { // 坐标轴线
                lineStyle: { // 属性lineStyle控制线条样式
                    color: [
                        [0.1, '#ffffff'],
                        [1, '#34364d']
                    ],
                    width: 3,
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            axisLabel: { // 坐标轴小标记
                textStyle: { // 属性lineStyle控制线条样式
                    fontWeight: 'bolder',
                    color: '#fff',
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            axisTick: { // 坐标轴小标记
                length: 5, // 属性length控制线长
                lineStyle: { // 属性lineStyle控制线条样式
                    color: 'auto',
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            splitLine: { // 分隔线
                length: 15, // 属性length控制线长
                lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
                    width: 3,
                    color: '#fff',
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            pointer: { // 分隔线
                shadowColor: '#fff', //默认透明
                shadowBlur: 5
            },
            itemStyle: {
                color: '#a08596'
            },
            detail: {
                //backgroundColor: 'rgba(30,144,255,0.8)',
                show: false,
                shadowColor: '#fff', //默认透明
                shadowBlur: 5,
                offsetCenter: [0, '15%'], // x, y，单位px
                textStyle: { // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                    fontWeight: 'bolder',
                    color: '#fff'
                }
            },
            data: [{
                value: 80,
                name: '当前流速'
            }]
        }]
    };
    return option;
}

/**
 * 获取防火墙流量折线图配置项
 */
function getFirewallStreamLineOption() {
    let option = {
        backgroundColor: '',
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    color: '#fcfcfc',
                    backgroundColor: '#a08596'
                }
            }
        },
        color: ['#fff', '#749F83', '#62879F'],
        legend: {
            textStyle: {
                color: '#fcfcfc',
                fontSize: 12
            },
            top: '4%',
            data: ['当前流量', '上限流量', '下限流量']
        },
        grid: {
            left: '0%',
            right: '15%',
            bottom: '5%',
            containLabel: true
        },
        xAxis: {
            type: 'time',
            name: '时间',
            nameTextStyle: {
                fontSize: 12,
            },
            splitLine: {
                show: false
            },
            splitNumber: 6,
            axisLine: {
                lineStyle: {
                    color: '#fcfcfc'
                }
            }
        },
        yAxis: {
            type: 'value',
            name: '流量',
            nameTextStyle: {
                fontSize: 12,
            },
            axisLine: {
                lineStyle: {
                    color: '#fcfcfc'
                }
            },
            axisLabel: {
                formatter: '{value} 次'
            },
            axisPointer: {
                snap: true
            }
        },
        series: [{
                name: '当前流量',
                type: 'line',
                showSymbol: false,
                hoverAnimation: false,
                data: [],
                itemStyle: {
                    //color: '#fff'
                },
                smooth: true,
            },
            {
                name: '上限流量',
                type: 'line',
                showSymbol: false,
                hoverAnimation: false,
                data: [],
                itemStyle: {
                    //color: '#749F83'
                },
                lineStyle:{
                    type:'dotted'
                },
                smooth: true,
            },
            {
                name: '下限流量',
                type: 'line',
                showSymbol: false,
                hoverAnimation: false,
                data: [],
                itemStyle: {
                    //color: '#62879F'
                },
                lineStyle:{
                    type:'dotted'
                },
                smooth: true
            }
        ]
    };
    return option;
}

/**
 * 获取攻击事件类型饼图配置项
 */
function getAttackTypePieOption() {
    let option = {
        backgroundColor: '',
        tooltip: {
            trigger: 'item',
            formatter: "{b} <br/>发生次数: {c} 次(占比{d}%)"
        },
        series: [{
            type: 'pie',
            position: 'center',
            center: ['50%', '50%'],
            radius: ['30%', '60%'],
            data: [{
                    value: 800,
                    name: '病毒攻击'
                },
                {
                    value: 700,
                    name: '异常流量'
                },
                {
                    value: 600,
                    name: '扫描攻击'
                },
                {
                    value: 500,
                    name: 'DDos攻击'
                },
                {
                    value: 300,
                    name: '其它'
                }

            ],
            itemStyle: {
                normal: {
                    color: '#fff'
                },
                emphasis: {
                    color: '#a08596',
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }]
    };
    return option;
}

/**
 * 获取异常事件类型柱状图
 */
function getAbnormalTypeBarOption() {
    let option = {
        backgroundColor: '',
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }

        },
        grid: {
            left: '0%',
            right: '15%',
            bottom: '5%',
            top: '20%',
            containLabel: true
        },
        xAxis: [{
            name: '类型',
            nameTextStyle: {
                fontSize: 12,
            },
            data: ['IP', '端口', '流量', '访客'],
            type: 'category',
            axisLine: {
                lineStyle: {
                    color: '#fcfcfc',
                    width: 1, //这里是为了突出显示加上的
                }
            },
            axisTick: {
                alignWithLabel: true
            },

        }],
        yAxis: [{
            name: '数量',
            nameTextStyle: {
                fontSize: 12
            },
            type: 'value',
            axisLine: {
                lineStyle: {
                    color: '#fcfcfc',
                    width: 1, //这里是为了突出显示加上的
                }
            },
            axisTick: {
                alignWithLabel: true
            },
            axisLabel: {
                formatter: '{value}'
            }
        }],
        series: [{
            barWidth: '40%',
            type: 'bar',
            data: [38, 35, 25, 22],
            itemStyle: {
                normal: {
                    color: '#fff'
                }
            }
        }]
    };
    return option;
}

/**
 * 外围时间盘
 */
function getAttackTimeGaugeOption() {
    let option = {
        backgroundColor: '',
        tooltip: {
            formatter: "{a} <br/>{c} {b}"
        },
        series: [{
            name: '时间',
            type: 'gauge',
            min: 1,
            max: 25,
            splitNumber: 24,
            radius: '85%',
            startAngle: 90,
            endAngle: -269.9,
            axisLine: { // 仪表盘轴线
                lineStyle: {
                    //24*4=96格
                    color: [
                        [0.375, '#fff'],
                        [1, '#34364d']
                    ],
                    width: 3,
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            axisLabel: { // 坐标轴小标记
                show: true,
                textStyle: { // 属性lineStyle控制线条样式
                    fontWeight: 'bolder',
                    color: '#fff',
                    fontSize: 12
                },
                distance: -40,
                formatter: function (value) {
                    if (value == 25)
                        return '';
                    else {
                        return value - 1;
                    }
                }
            },
            axisTick: { // 坐标轴小标记
                length: 5,
                splitNumber: 4,
                lineStyle: {
                    color: 'auto',
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 5
                }
            },
            splitLine: { // 仪表盘分隔线
                length: 15,
                lineStyle: {
                    width: 3,
                    color: '#fff',
                    shadowColor: '#fff', //默认透明
                    shadowBlur: 10
                }
            },
            pointer: { // 指针
                show: false
            },
            title: {
                show: false
            },
            detail: {
                show: false
            },
            data: [{
                value: 4,
                name: 'km/h'
            }]
        }]
    };
    return option;
}

/**
 * 获取攻击溯源地图配置项
 */
function getAttackSourceMapOption() {
    var option = {
        backgroundColor: '',
        title: {
            left: 'center',
            textStyle: {
                color: '#fff'
            }
        },
        tooltip: {
            trigger: 'item'
        },
        geo: {
            map: 'china',
            regions: [{
                name: '南海诸岛',
                value: 0,
                itemStyle: {
                    normal: {
                        opacity: 0,
                        label: {
                            show: false
                        }
                    }
                }
            }],
            label: {
                emphasis: {
                    show: false
                }
            },
            roam: false,
            itemStyle: {
                normal: {
                    areaColor: '#222538',
                    borderColor: '#ffffff',
                    borderWidth: 1
                },
                emphasis: {
                    areaColor: '#a08596'
                }
            }
        },
        series: [
            /*             {
                            name: 'background',
                            type: 'map',
                            mapType: 'china',
                            label: {
                                show:false
                            },
                            tooltip:{
                                show:false
                            },
                            data:[
                            ]
                        }, */
            {
                name: "访客源所在城市",
                type: 'effectScatter',
                coordinateSystem: 'geo',
                zlevel: 2,
                symbol: "emptyCircle",
                symbolSize: function (val) {
                    return 10 + val[2] / 10;
                },
                rippleEffect: {
                    period: 4,
                    scale: 5,
                    brushType: 'stroke'
                },
                label: {
                    show: false
                },
                itemStyle: {
                    normal: {
                        //color: '#46bee9',
                        color: "red",
                        opacity: 0.5
                    }
                },
                tooltip: {
                    formatter: function (param) {
                        //console.log(param);
                        return `${param.value[3]}<br/>共发起${param.value[2]}次攻击`;
                    }
                },
                data: [],
            }
        ]
    };
    return option;
}